home *** CD-ROM | disk | FTP | other *** search
- function RotatorEffect_GetLayer(layer_name)
- { if (document.all) return document.all[layer_name];
- else if (document.layers) document.layers[layer_name];
- else return null;
- }
- function RotatorEffect_SetTop(TopPos)
- {
- var Me = this;
-
- if (document.all)
- document.all[Me.target].style.posTop = TopPos;
- else if (document.layers)
- document.layers[Me.target].top = TopPos;
- }
- function RotatorEffect_GetTop()
- {
- var Me = this;
-
- if (document.all)
- return document.all[Me.target].style.posTop;
- else if (document.layers)
- return document.layers[Me.target].top;
- }
- function RotatorEffect_ScrollTimer(target,cy)
- { var Me = this;
- var i;
- var IsReset = false;
- if (this.num != 0) return;
- if (Me.counter.poser && 0 == (Me.counter.poser % Me.ClipHeight))
- IsReset = true;
- if (Me.counter.Stop)
- { setTimeout("if ('undefined' == typeof(" + this.name + ")) document.location.reload(true); else " + Me.name + ".ScrollTimer('" + target + "'," + cy + ");",Me.DelayTime);
- return;
- }
- for (i = 0; i < this.counter.stack.length; i++)
- { var item = this.counter.stack[i];
- item.ScrollText(item.target,cy);
- }
- if (0 == this.num)
- this.counter.poser ++;
- if (IsReset)
- setTimeout("if ('undefined' == typeof(" + this.name + ")) document.location.reload(true); else " + Me.name + ".ScrollTimer('" + target + "'," + cy + ");",Me.RepeatDelay);
- else
- setTimeout("if ('undefined' == typeof(" + this.name + ")) document.location.reload(true); else " + Me.name + ".ScrollTimer('" + target + "'," + cy + ");",Me.DelayTime);
- }
- function RotatorEffect_ScrollText(target,cy)
- { var Me = this;
- var IsReset = false;
- var IsSizing= false;
- var text_attr = Me.text_attr.Clone();
- var new_text;
-
- if (document.all)
- CellHeight = document.all[target].offsetHeight;
- else if (document.layers)
- CellHeight = Me.ClipHeight;
-
- if (Me.GetTop() <= (Me.OrgTop - 2 * Me.ClipHeight))
- { factor = (Me.counter.count > 1)? Me.counter.count - 2 : 0 ;
- Me.YClip = 0;
- Me.ClipTop = 0;
- Me.ClipBottom = 0;
- Me.YOff = 0;
- Me.SetTop(Me.OrgTop + factor * Me.ClipHeight);
- }
- else
- { if (Me.GetTop() <= (Me.OrgTop - Me.ClipHeight + 1))
- Me.ClipTop = Me.ClipTop + cy;
- if (Me.GetTop() < (Me.OrgTop))
- Me.ClipBottom= Me.ClipBottom + cy;
- }
-
- if (Me.GetTop() < (Me.OrgTop) && Me.GetTop() >= (Me.OrgTop - Me.ClipHeight + 1))
- IsSizing = true;
-
- NewClip = 'rect(' + Me.ClipTop + ' ' + Me.ClipRight + ' ' + Me.ClipBottom + ' ' + Me.ClipLeft + ')';
- // Test
- if (IsSizing)
- {
- switch(Me.GetTop() % 9)
- {
- case 6: case 7: case 8: text_attr.Size = text_attr.Size + 1; break;
- case 0: case 1: case 2: text_attr.Size = text_attr.Size - 1; break;
- }
- }
- // Update New Text HTML
- if (Me.text)
- new_text = AddLink(BlinkTextBlock(Me.text,text_attr),Me.text_link);
- // Update Layer
- if (document.all)
- {
- if (1 == Me.First)
- {
- Me.First = 0;
- // document.all[target].style.posTop =document.all[target].offsetTop + Me.ClipHeight + Me.YOff;
- document.all[target].style.posTop =document.all[this.counter.target].offsetTop + Me.ClipHeight + Me.YOff;
- document.all[target].style.posLeft=document.all[this.counter.target].offsetLeft;
- Me.OrgTop = document.all[target].style.posTop - Me.YOff;
- }
-
- document.all[target].style.posTop = document.all[target].style.posTop - cy;
- document.all[target].style.clip = NewClip;
- if (Me.text)
- document.all[target].innerHTML = new_text;
- }
- else if (document.layers)
- {
- if (1 == Me.First)
- {
- Me.First = 0;
- Me.OrgTop = document.layers[target].top - Me.YOff;
- }
- document.layers[target].top = document.layers[target].top - cy;
- document.layers[target].clip.top = Me.ClipTop;
- document.layers[target].clip.bottom = Me.ClipBottom;
-
- if (Me.text)
- {
- document.layers[target].document.open()
- document.layers[target].document.write(new_text);
- document.layers[target].document.close();
- }
- }
- }
- function RotatorEffect_Init(target,target_NS,delay,YOff,ClipWidth,ClipHeight,text,text_link,text_color,text_face,text_size,RepeatTime)
- { var Me = this;
-
- if (document.layers)
- {
- if (document.layers[target] == null)
- Me.target = target_NS;
- else
- Me.target = target; //target_NS ???;
- document.layers[Me.target].top = document.layers[this.counter.target].top + ClipHeight + YOff;
- document.layers[Me.target].left= document.layers[this.counter.target].left;
- }
- else if (document.all)
- {
- Me.target = target;
- // document.all[target].style.posTop =document.all[this.counter.target].offsetTop + ClipHeight + YOff;
- // document.all[target].style.posLeft=document.all[this.counter.target].offsetLeft;
- }
-
- Me.First = 1;
- Me.YOff = YOff;
- Me.YClip = 1;
- Me.ClipWidth = ClipWidth;
- Me.ClipHeight = ClipHeight;
- Me.ClipLeft = 0;
- Me.ClipRight = ClipWidth;
- Me.ClipTop = 0;
- Me.ClipBottom = 0;
- Me.DelayTime = delay;
- Me.RepeatDelay = RepeatTime;
- Me.Repeat = true;
- Me.text = text;
- Me.text_link = text_link;
- Me.text_attr = new TextBlock();
- Me.text_attr.UseTextColor = true;
- Me.text_attr.UseFont = true;
- Me.text_attr.UseSize = true;
- Me.text_attr.TextColor = text_color;
- Me.text_attr.Font = text_face;
- Me.text_attr.Size = text_size;
-
- setTimeout(Me.name + ".ScrollTimer('" + Me.target + "',1);",50);
- }
- function RotatorEffect_OnMouseOver(event)
- { if (this.PauseOnOver) this.counter.Stop = true;
- var target_layer = GetLayer(this.counter.target);
- if (target_layer)
- if (target_layer.onmouseover)
- target_layer.onmouseover(event);
- }
- function RotatorEffect_OnMouseOut(event)
- { if (this.PauseOnOver) this.counter.Stop = false;
- var target_layer = GetLayer(this.counter.target);
- if (target_layer)
- if (target_layer.onmouseout)
- target_layer.onmouseout(event);
- }
- function RotatorStack(target)
- { this.count = 0;
- this.Stop = false;
- this.target = target;
- this.stack = new Array;
- this.poser = 0;
- }
- function RotatorEffect(name,counter,IsPause)
- { this.Init = RotatorEffect_Init;
- this.ScrollTimer = RotatorEffect_ScrollTimer;
- this.ScrollText = RotatorEffect_ScrollText;
- this.SetTop = RotatorEffect_SetTop;
- this.GetTop = RotatorEffect_GetTop;
- this.GetLayer = RotatorEffect_GetLayer;
- this.OnMouseOver = RotatorEffect_OnMouseOver;
- this.OnMouseOut = RotatorEffect_OnMouseOut;
- this.name = name;
- this.counter = counter;
- this.num = this.counter.count;
- this.PauseOnOver = IsPause;
- this.counter.count ++;
- this.counter.stack[this.counter.stack.length] = this;
- }
-